<form>
<div class="x-list-title">
<table width="100%" border="0">
	<tr>
		<td align="left">
			<h2>Danh sách lịch cơ quan</h2>
		</td>
		<td align="right">	
			<div class="x-list-options">	
				<a href="#Calendar/Index/Add" class="x-button">Lịch cá nhân mới</a>
				<a href="#Calendar/Company/Add" class="x-button">Lịch cơ quan mới</a>
			</div>	
		</td>
	</tr>
</table>	
</div>
<div class="calendar-bar-container">
	<div class="calendar-bar">
		<?php include '_Options.phtml';?>
	</div>
</div>
<?php $id = getId(); ?>
<?php
$vars = $this->get('vars');
$link = '#'.$this->module."/".$this->controller."/".$this->action;
?>
<form action="<?php _baseUrl()?>/Task/Act" method="post" id="f<?php _e($id);?>">
<table width="100%" class="x-list" cellpadding="0" cellspacing="0">
<tr>
	<th width="25" align="center">
		TT
	</th>
	<th align="center">
		<?php show_order_link('Sự kiện','title',$link,$vars) ;?>
	</th>
	<th align="center" width="120">
		<?php show_order_link('Phòng ban','department_id',$link,$vars) ;?>
	</th>
	<th align="center" width="120">
		<?php show_order_link('Địa điểm','place',$link,$vars) ;?>
	</th>
	<th align="center" width="120">
		<?php show_order_link('Chuẩn bị','tools',$link,$vars) ;?>
	</th>
	<th align="center" width="100">
		<?php show_order_link('Tạo bởi','created_by_id',$link,$vars) ;?>
	</th>
	<th align="center" width="50" colspan="2">Tác vụ</th>
	<th align="center" width="25">
		<div class="x-check-container">
			<div class="x-check">
			<input type="checkbox" class="x-checkbox x-checkall"/>
			</div>
			<div class="x-check-options">
				<a class="x-check-item check-all">Chọn tất cả</a>
				<a class="x-check-item uncheck-all">Bỏ chọn tất cả</a>
			</div>
		</div>
	</th>
</tr>
<?php if( count($this->get("posts")) > 0 ): ?>
<?php foreach( $this->get("posts") as $k => $a ): ?>
<tr>
<td align="center">
	<?php _e($k+1);?>
</td>
<td>
	<a href="#Calendar/Company/View?ID=<?php _e($a['ID']);?>">
		<?php _e($a['title']);?></a>
</td>
<td align="center">
	<?php _e($a['department_title']);?>
</td>
<td align="center">
	<?php _e( $a['place'] );?>
</td>
<td align="center">
	<?php _e( $a['tools'] );?>
</td>

<td align="center">
	<?php _e( get_user_link($a['created_by_id'],$a['created_by_name'],$a['created_is_deleted']));?>
</td>
<td align="center" width="25">
	<?php if( $this->hasRole('add_company_calendar') ):?>
	<a onclick="module_delete('<?php _baseUrl()?>/Calendar/Company/Delete?ID=<?php _e($a['ID'])?>&redirect_url=<?php _e(rawurlencode("#Calendar/Company/List") )?>')" class="x-delete"></a>
	<?php else:?>
	<a class="x-nodelete"></a>
	<?php endif;?>
</td>
<td align="center" width="25">
	<?php if( $this->hasRole('add_company_calendar') ):?>
	<a href="#Calendar/Company/Edit?ID=<?php _e($a['ID'])?>" class="x-edit"></a>
	<?php else:?>
	<a class="x-noedit"></a>
	<?php endif;?>
</td>	
<td align="center">
	<input name="ID[]" value="<?php _e($a['ID'])?>" type="checkbox" class="x-checkbox x-checkall"/>
</td>
</tr>
<?php endforeach;?>
<tr>
	<td colspan="9" class="page">
	<div class="x-page">
		<?php $this->e("page");?>
	</div>		
	</td>
</tr>
<?php else:?>
<tr>
	<td colspan="9" class="page"><div class="x-page">
			Không có sự kiện nào được tìm thấy
		</div>
	</td>
</tr>
<?php endif;?>
</table><br/><br/>
</form>